package com.yunxi.module.system.mapper.logger;

import com.yunxi.framework.common.pojo.PageResult;
import com.yunxi.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.module.system.dto.logger.OperateLogPageReqDTO;
import com.yunxi.module.system.model.logger.OperateLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * 操作日志 mapper
 * </p>
 *
 * @author lidy
 * @since 2024-05-08
 */
@Mapper
public interface OperateLogMapper extends BaseMapperX<OperateLogDO> {

    /**
     * 获得操作日志分页列表
     *
     * @param pageReqVO 分页条件
     * @return 操作日志分页列表
     */
    default PageResult<OperateLogDO> selectPage(OperateLogPageReqDTO pageReqVO) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<OperateLogDO>()
                .eqIfPresent(OperateLogDO::getType, pageReqVO.getType())
                .eqIfPresent(OperateLogDO::getBizId, pageReqVO.getBizId())
                .eq(OperateLogDO::getUserId, pageReqVO.getUserId())
                .orderByDesc(OperateLogDO::getId));
    }
}
